package com.joanzapata.pdfview;

/* loaded from: classes.dex */
class SpiralLoopManager {
    private SpiralLoopListener listener;

    /* loaded from: classes.dex */
    public interface SpiralLoopListener {
        boolean onLoop(int i, int i2);
    }

    private boolean isValidCell(int i, int i2, int i3, int i4) {
        return i >= 0 && i < i3 && i2 >= 0 && i2 < i4;
    }

    public SpiralLoopManager(SpiralLoopListener spiralLoopListener) {
        if (spiralLoopListener == null) {
            throw new IllegalArgumentException("SpiralLoopListener must not be null");
        }
        this.listener = spiralLoopListener;
    }

    /*  JADX ERROR: JadxOverflowException in pass: LoopRegionVisitor
        jadx.core.utils.exceptions.JadxOverflowException: LoopRegionVisitor.assignOnlyInLoop endless recursion
        	at jadx.core.utils.ErrorsCounter.addError(ErrorsCounter.java:56)
        	at jadx.core.utils.ErrorsCounter.error(ErrorsCounter.java:30)
        	at jadx.core.dex.attributes.nodes.NotificationAttrNode.addError(NotificationAttrNode.java:18)
        */
    public void startLoop(int r8, int r9, int r10, int r11) {
        /*
            r7 = this;
            int r0 = r9 * r8
            com.joanzapata.pdfview.SpiralLoopManager$SpiralLoopListener r1 = r7.listener
            r1.onLoop(r10, r11)
            r1 = 1
            r2 = 1
            r3 = 1
        La:
            if (r1 >= r0) goto L45
            r4 = 0
            r5 = r1
            r1 = r10
            r10 = 0
        L10:
            if (r10 >= r2) goto L27
            int r1 = r1 + r3
            boolean r6 = r7.isValidCell(r1, r11, r8, r9)
            if (r6 == 0) goto L24
            int r5 = r5 + 1
            com.joanzapata.pdfview.SpiralLoopManager$SpiralLoopListener r6 = r7.listener
            boolean r6 = r6.onLoop(r1, r11)
            if (r6 != 0) goto L24
            return
        L24:
            int r10 = r10 + 1
            goto L10
        L27:
            if (r4 >= r2) goto L3e
            int r11 = r11 + r3
            boolean r10 = r7.isValidCell(r1, r11, r8, r9)
            if (r10 == 0) goto L3b
            int r5 = r5 + 1
            com.joanzapata.pdfview.SpiralLoopManager$SpiralLoopListener r10 = r7.listener
            boolean r10 = r10.onLoop(r1, r11)
            if (r10 != 0) goto L3b
            return
        L3b:
            int r4 = r4 + 1
            goto L27
        L3e:
            int r2 = r2 + 1
            int r3 = r3 * (-1)
            r10 = r1
            r1 = r5
            goto La
        L45:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.joanzapata.pdfview.SpiralLoopManager.startLoop(int, int, int, int):void");
    }
}
